*Paper: Fiscal Rules, Corruption and Electoral Accountability - Replication Files

clear all
cap log close 
set more off


**Global files
global folder "/Users/tommasogiommoni/Dropbox/Determinants of corruption/Stability pact and corruption/Replication files JOP"


********************************************************************************
****----						Dataset open 					    	----**** 
********************************************************************************

use "$folder/Data/dataset_feb2024.dta", clear

**-- Global

global controls7 proportion_female_Elected_lag av_education_Elected_lag av_age_Elected_lag  victory_margin_lag term_limit_lag 
global controls7_int  c.proportion_female_Elected_lag##i.anno c.av_education_Elected_lag##i.anno c.av_age_Elected_lag##i.anno c.victory_margin_lag##i.anno  c.term_limit_lag##i.anno

**-- Panel dataset

xtset codcom anno
fvset base 2012 anno

********************************************************************************
****----							Analysis							----**** 
********************************************************************************

********--------  Estimates	--------********

********--------  Tax rate

foreach j in house_tax_ordinary {
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<1000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<1200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<1400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<1600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<1800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<2000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<2200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<2400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<2600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<2800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<3000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<3200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<3400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<3600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<3800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year population_anagrafe_V##post_2012 $controls7_int if abs(P)<4000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_4000_`j'_FCR_int.dta", replace)
}

********--------  Analysis on Current/Capita/Total expenditures

foreach j in current_exp_PC capital_ext_PC current_cappital_exp_PC{
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<1000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<1200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<1400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<1600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<1800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_1800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<2000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<2200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<2400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<2600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<2800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_2800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<3000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3000_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<3200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3200_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<3400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3400_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<3600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3600_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<3800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_3800_`j'_FCR_int.dta", replace)
quietly reghdfe `j'  S##T P  i.region_year $controls7_int if abs(P)<4000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) vce(cluster codcom)
parmest, saving("$folder/Data/estimates/est_4000_`j'_FCR_int.dta", replace)
}

********--------  Analysis on procurement expenditures

foreach j in procurement_amount_PC{
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<1000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_1000_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<1200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_1200_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<1400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_1400_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<1600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_1600_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<1800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_1800_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<2000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_2000_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<2200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_2200_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<2400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_2400_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<2600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_2600_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<2800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_2800_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<3000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_3000_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<3200 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_3200_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<3400 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_3400_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<3600 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_3600_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<3800 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_3800_`j'_FCR_int.dta", replace)
quietly reghdfe `j' S##T P i.region_year $controls7_int if abs(P)<4000 & (special_region==0 | regione=="SICILIA" | regione=="SARDEGNA"), absorb(codcom) cluster(codcom)
parmest, saving("$folder/Data/estimates/est_4000_`j'_FCR_int.dta", replace)
}

********-------- Figures --------******** 

********--------  Tax rate

preserve
foreach j in house_tax_ordinary {
use "$folder/Data/estimates/est_1000_`j'_FCR_int.dta", clear
append using "$folder/Data/estimates/est_1200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_4000_`j'_FCR_int.dta"

qui keep if parm=="1.S#1.T"
qui gen sign=stderr*1.654
qui gen min90=estimate-sign
qui gen max90=estimate+sign
qui keep estimate min95 max95 min90 max90

qui gen h=.
qui replace h=1000 if _n==1
qui replace h=1200 if _n==2
qui replace h=1400 if _n==3
qui replace h=1600 if _n==4
qui replace h=1800 if _n==5
qui replace h=2000 if _n==6
qui replace h=2200 if _n==7
qui replace h=2400 if _n==8
qui replace h=2600 if _n==9
qui replace h=2800 if _n==10
qui replace h=3000 if _n==11
qui replace h=3200 if _n==12
qui replace h=3400 if _n==13
qui replace h=3600 if _n==14
qui replace h=3800 if _n==15
qui replace h=4000 if _n==16

twoway rcap min95 max95 h, color(black black) lwidth(*0.75) ||rcap min90 max90 h, color(black black) lwidth(*1.25) || connected estimate h, graphregion(color(white)) lpattern(dash) lcolor(grey) mcolor(black) ///
ylabel(-.1(.025).1, angle(horizontal)) xlabel(1000(200)4000,  angle(45)) legend(off) title("") xtitle("Bandwidth") yline(0)
gr export "$folder/Figures/FigureA9_a.png" , replace 
}
restore

********--------  Analysis on Current/Capita/Total expenditures

preserve
foreach j in current_exp_PC {
use "$folder/Data/estimates/est_1000_`j'_FCR_int.dta", clear
append using "$folder/Data/estimates/est_1200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_4000_`j'_FCR_int.dta"

qui keep if parm=="1.S#1.T"
qui gen sign=stderr*1.654
qui gen min90=estimate-sign
qui gen max90=estimate+sign
qui keep estimate min95 max95 min90 max90

qui gen h=.
qui replace h=1000 if _n==1
qui replace h=1200 if _n==2
qui replace h=1400 if _n==3
qui replace h=1600 if _n==4
qui replace h=1800 if _n==5
qui replace h=2000 if _n==6
qui replace h=2200 if _n==7
qui replace h=2400 if _n==8
qui replace h=2600 if _n==9
qui replace h=2800 if _n==10
qui replace h=3000 if _n==11
qui replace h=3200 if _n==12
qui replace h=3400 if _n==13
qui replace h=3600 if _n==14
qui replace h=3800 if _n==15
qui replace h=4000 if _n==16

twoway rcap min95 max95 h, color(black black) lwidth(*0.75) ||rcap min90 max90 h, color(black black) lwidth(*1.25) || connected estimate h, graphregion(color(white)) lpattern(dash) lcolor(grey) mcolor(black) ///
ylabel(-75(25)75, angle(horizontal)) xlabel(1000(200)4000,  angle(45)) legend(off) title("") xtitle("Bandwidth") yline(0)
gr export "$folder/Figures/FigureA9_b.png" , replace 
}
restore

preserve
foreach j in capital_ext_PC {
use "$folder/Data/estimates/est_1000_`j'_FCR_int.dta", clear
append using "$folder/Data/estimates/est_1200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_4000_`j'_FCR_int.dta"

qui keep if parm=="1.S#1.T"
qui gen sign=stderr*1.654
qui gen min90=estimate-sign
qui gen max90=estimate+sign
qui keep estimate min95 max95 min90 max90

qui gen h=.
qui replace h=1000 if _n==1
qui replace h=1200 if _n==2
qui replace h=1400 if _n==3
qui replace h=1600 if _n==4
qui replace h=1800 if _n==5
qui replace h=2000 if _n==6
qui replace h=2200 if _n==7
qui replace h=2400 if _n==8
qui replace h=2600 if _n==9
qui replace h=2800 if _n==10
qui replace h=3000 if _n==11
qui replace h=3200 if _n==12
qui replace h=3400 if _n==13
qui replace h=3600 if _n==14
qui replace h=3800 if _n==15
qui replace h=4000 if _n==16

twoway rcap min95 max95 h, color(black black) lwidth(*0.75) ||rcap min90 max90 h, color(black black) lwidth(*1.25) || connected estimate h, graphregion(color(white)) lpattern(dash) lcolor(grey) mcolor(black) ///
ylabel(-150(50)150, angle(horizontal)) xlabel(1000(200)4000,  angle(45)) legend(off) title("") xtitle("Bandwidth") yline(0)
gr export "$folder/Figures/FigureA9_c.png" , replace 
}
restore

preserve
foreach j in current_cappital_exp_PC {
use "$folder/Data/estimates/est_1000_`j'_FCR_int.dta", clear
append using "$folder/Data/estimates/est_1200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_4000_`j'_FCR_int.dta"

qui keep if parm=="1.S#1.T"
qui gen sign=stderr*1.654
qui gen min90=estimate-sign
qui gen max90=estimate+sign
qui keep estimate min95 max95 min90 max90

qui gen h=.
qui replace h=1000 if _n==1
qui replace h=1200 if _n==2
qui replace h=1400 if _n==3
qui replace h=1600 if _n==4
qui replace h=1800 if _n==5
qui replace h=2000 if _n==6
qui replace h=2200 if _n==7
qui replace h=2400 if _n==8
qui replace h=2600 if _n==9
qui replace h=2800 if _n==10
qui replace h=3000 if _n==11
qui replace h=3200 if _n==12
qui replace h=3400 if _n==13
qui replace h=3600 if _n==14
qui replace h=3800 if _n==15
qui replace h=4000 if _n==16

twoway rcap min95 max95 h, color(black black) lwidth(*0.75) ||rcap min90 max90 h, color(black black) lwidth(*1.25) || connected estimate h, graphregion(color(white)) lpattern(dash) lcolor(grey) mcolor(black) ///
ylabel(-150(50)150, angle(horizontal)) xlabel(1000(200)4000,  angle(45)) legend(off) title("") xtitle("Bandwidth") yline(0)
gr export "$folder/Figures/FigureA9_e.png" , replace 
}
restore

********--------  Analysis on procurement expenditures

preserve
foreach j in procurement_amount_PC{
use "$folder/Data/estimates/est_1000_`j'_FCR_int.dta", clear
append using "$folder/Data/estimates/est_1200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_1800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_2800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3000_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3200_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3400_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3600_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_3800_`j'_FCR_int.dta"
append using "$folder/Data/estimates/est_4000_`j'_FCR_int.dta"

qui keep if parm=="1.S#1.T"
qui gen sign=stderr*1.654
qui gen min90=estimate-sign
qui gen max90=estimate+sign
qui keep estimate min95 max95 min90 max90

qui gen h=.
qui replace h=1000 if _n==1
qui replace h=1200 if _n==2
qui replace h=1400 if _n==3
qui replace h=1600 if _n==4
qui replace h=1800 if _n==5
qui replace h=2000 if _n==6
qui replace h=2200 if _n==7
qui replace h=2400 if _n==8
qui replace h=2600 if _n==9
qui replace h=2800 if _n==10
qui replace h=3000 if _n==11
qui replace h=3200 if _n==12
qui replace h=3400 if _n==13
qui replace h=3600 if _n==14
qui replace h=3800 if _n==15
qui replace h=4000 if _n==16

twoway rcap min95 max95 h, color(black black) lwidth(*0.75) ||rcap min90 max90 h, color(black black) lwidth(*1.25) || connected estimate h, graphregion(color(white)) lpattern(dash) lcolor(grey) mcolor(black) ///
ylabel(-750(250)750, angle(horizontal)) xlabel(1000(200)4000,  angle(45)) legend(off) title("") xtitle("Bandwidth") yline(0)
gr export "$folder/Figures/FigureA9_d.png" , replace 
}
restore

